In [31]:
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import matplotlib.dates as mdate
%matplotlib inline
import matplotlib.pylab as pylab
pylab.rcParams['figure.figsize'] = 16, 12
from sunpy.time import TimeRange

In [2]:
utc_offset = -7

In [3]:
foxsi_launch_time_local = datetime.strptime('2014/12/11 11:55', '%Y/%m/%d %H:%M')

In [4]:
foxsi_launch_time_local


Out[4]:
datetime.datetime(2014, 12, 11, 11, 55)

In [6]:
foxsi_launch_time_ut = foxsi_launch_time_local - timedelta(hours=utc_offset)
print(datetime.strftime(foxsi_launch_time_ut, '%Y/%m/%d %H:%M'))


2014/12/11 18:55

In [8]:
foxsi_obs_tr = TimeRange([foxsi_launch_time_ut + timedelta(seconds=111), foxsi_launch_time_ut + timedelta(seconds=505)])

In [9]:
print(foxsi_obs_tr)


    Start: 2014-12-11 18:56:51
    End:   2014-12-11 19:03:25
    Center:2014-12-11 19:00:08
    Duration:0.00456018518519 days or
           0.109444444444 hours or
           6.56666666667 minutes or
           394.0 seconds

updated on dec 1st

iris eclipse free: 18:06- 19:01, 19:44 - 20:39, 21:21-22:16 SAA free:18:20-19:39, 19:58-21:19, 21:34-22:59 best times (free of SAAs and eclipses): 18:20 - 19:01, 19:58 - 20:39, 21:34- 22:16


In [25]:
iris = [TimeRange(['2014/12/11 18:20', '2014/12/11 19:01']),
                TimeRange(['2014/12/11 19:58', '2014/12/11 20:39']),
                TimeRange(['2014/12/11 21:34', '2014/12/11 22:16'])]

In [26]:
nustar = [TimeRange(['2014/12/11 15:24', '2014/12/11 16:26']), 
          TimeRange(['2014/12/11 17:01', '2014/12/11 18:04']), 
          TimeRange(['2014/12/11 18:38', '2014/12/11 19:41']), 
          TimeRange(['2014/12/11 20:14', '2014/12/11 21:18']),
          TimeRange(['2014/12/11 21:51', '2014/12/11 22:55'])]

RHESSI Day 2014/345 17:18:04 - 2014/345 18:22:30 UTC 64.433 min Orbit 70605 2014/345 18:52:52 - 2014/345 19:57:24 UTC 64.533 min Orbit 70606 2014/345 20:27:41 - 2014/345 21:32:19 UTC 64.633 min Orbit 70607 2014/345 22:02:30 - 2014/345 23:07:13 UTC 64.717 min Orbit 70608 RHESSI SAA 2014/345 11:10:07 - 2014/345 11:26:29 UTC 16.367 min Orbit 70601 2014/345 12:50:29 - 2014/345 12:58:44 UTC 8.250 min Orbit 70602 2014/345 21:51:09 - 2014/345 21:56:15 UTC 5.100 min Orbit 70608


In [27]:
rhessi = [TimeRange(['2014/12/11 17:18:04', '2014/12/11 18:22:30']),
          TimeRange(['2014/12/11 18:52:52', '2014/12/11 19:57:24']),
          TimeRange(['2014/12/11 20:27:41', '2014/12/11 21:32:19'])]

In [51]:
hinode = [TimeRange(['2014/12/11 16:12:30', '2014/12/11 17:12:30']), 
          TimeRange(['2014/12/11 18:26:00', '2014/12/11 18:49:00']),
          TimeRange(['2014/12/11 20:03:00', '2014/12/11 21:03:00'])]

In [83]:
fig = plt.figure()
fig, ax = plt.subplots(nrows=4)
date_fmt = '%b-%d %H:%M'
date_formatter = mdate.DateFormatter(date_fmt)
names = ['rhessi', 'iris', 'hinode', 'nustar']
for i, obs in enumerate([rhessi, iris, hinode, nustar]):
    ax[i].set_xlim(datetime.strptime('2014/12/11 18:15', '%Y/%m/%d %H:%M'),
            datetime.strptime('2014/12/11 19:30', '%Y/%m/%d %H:%M'))
    ax[i].axvspan(foxsi_obs_tr.start, foxsi_obs_tr.end, alpha=1, label='foxsi', color='r')
    for j, t in enumerate(obs):
        name = names[i]
        span = [t.start, t.end]
        span_str = datetime.strftime(span[0], '%H:%M:%S') + '-' + datetime.strftime(span[1], '%H:%M:%S')
        ax[i].axvspan(span[0], span[1], facecolor='b', alpha=0.5, label = name + ' ' + span_str)

    #plt.text( span[0], 0.5, 'b', rotation=90)
    #plt.text( span[1], 0.5, name + ' End ' + datetime.strftime(span[1], '%H:%M'), rotation=90)
    ax[i].legend()
    ax[i].xaxis.set_major_formatter(date_formatter)
    ax[i].set_xlabel('Time (UT)')
    ax[i].axvline(foxsi_launch_time_ut, label="Launch", color='red')

#ax2 = ax.twiny()
#ax2.plot_date([time + timedelta(hours=utc_offset) for time in axis_range], [0,1])
#ax2.xaxis.set_major_formatter(date_formatter)
#plt.xticks(rotation=30)
#ax2.set_label('Time (Local)')
fig.autofmt_xdate()
plt.show()


<matplotlib.figure.Figure at 0x108bd7110>